package com.cuit.service.impl;

import com.cuit.entity.User;
import com.cuit.entity.Voice;
import com.cuit.mapper.VoiceMapper;
import com.cuit.service.VoiceService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
@Slf4j
@RequiredArgsConstructor
public class VoiceServiceImpl implements VoiceService {

    @Autowired
    private VoiceMapper voiceMapper;


    @Override
    public PageInfo<Voice> getVoices(int page, int size, String keyword) {
        PageHelper.startPage(page, size);
        List<Voice> voices = voiceMapper.selectByKeyword(keyword);
        return new PageInfo<>(voices);
    }
}
